﻿using ML.Entity;
using System.Collections.Generic;

namespace ML.IBusiness
{
    /// <summary>
    /// 订单业务接口
    /// </summary>
    public interface IOrderBusiness
    {
        /// <summary>
        /// 根据查询条件查询订单信息
        /// </summary>
        /// <param name="orderSearch">订单查询条件</param>
        /// <returns></returns>
        BaseResult<Pager<OrderResponse>> List(OrderSearch orderSearch);

        /// <summary>
        /// 根据订单Id查询订单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        BaseResult<OrderResponse> GetById(string id);

        /// <summary>
        /// 前端已经在使用此接口—根据订单Id查询订单信息关联收货地址、和子表数据组合返回
        /// </summary>
        /// <param name="id">订单Id</param>
        /// <returns></returns>
        BaseResult<OrderResponse> GetDetailById(string id);

        /// <summary>
        /// 前端已经在使用此接口—根据用户Id查询订单主表信息(关联商户以及订单子表信息)列表
        /// </summary>
        /// <param name="id">用户id</param>
        /// <returns></returns>
        BaseResult<IEnumerable<OrderResponse>> GetListByUserId(string id);

        /// <summary>
        /// 前端已经在使用此接口—订单添加(用户从购物车将订单插入到订单表(主子表))
        /// </summary>
        /// <param name="cartOrders">订单插入数据</param>
        /// <returns></returns>
        BaseResult<string> Add(CartOrders cartOrders);

        /// <summary>
        ///  订单信息修改
        /// </summary>
        /// <param name="entity">订单实体</param>
        /// <param name="cartOrder">修改信息</param>
        /// <returns></returns>
        BaseResult<bool> Update(OrderEntity entity, CartOrders cartOrder);

        /// <summary>
        /// 修改订单表状态
        /// </summary>
        /// <param name="Id">订单Id</param>
        /// <param name="State">(1:接单,2:商家取消，4:客户取消，3:已完成)</param>
        /// <returns></returns>
        BaseResult<bool> UpdateState(string Id, int State);

        /// <summary>
        /// 修改订单支付状态
        /// </summary>
        /// <param name="id">订单id</param>
        /// <param name="payState">支付订单状态（0：未支付；1：已支付）</param>
        /// <returns></returns>
        BaseResult<bool> UpdatePayState(string id, int payState);

        /// <summary>
        /// 根据商户id，获取已支付订单数量
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        BaseResult<List<int>> GetPaidOrderForWeek(string id);

        /// <summary>
        /// 根据商户id、类型，统计订单信息
        /// </summary>
        /// <returns></returns>
        BaseResult<OrderStatisticsResponse> GetOrderStatistics(string id,string type);

        /// <summary>
        /// 获取今日订单状态统计（微信小程序）
        /// </summary>
        /// <param name="id">商户id</param>
        /// <returns></returns>
        BaseResult<OrderStatusCountResponse> GetTodayOrderStatus(string id);
    }
}